Ext.define('appmod.view.role.maintain.Form', {
    extend: 'Ext.form.Panel',
    alias: 'widget.roleform',
    bodyPadding: 10,
	
	constructor: function (config) {
		
		if (config.fieldStores) {
			this.fieldStores = config.fieldStores;
		}
        this.callParent(arguments);
     },		
	
    initComponent: function() {
      var me = this;

	  	var fieldStores = me.fieldStores;
		var dsSysRoleIds = null;
		try {
			dsSysRoleIds = fieldStores['dsSysRoleId'];
		} catch (e) {
			Ext.log({
				msg : '[appmod.view.role.maintain.Form]' + e,
				level:'error'
			});
		}		  


      Ext.applyIf(me, {
	  	    fieldDefaults: {
            	labelWidth: 80
        	},
            items: [
                {
                    xtype: 'textfield',
                    name: 'name',
                    fieldLabel: '角色名称',
					anchor: '95%',
					allowBlank:false
                },
                {
                    xtype: 'textfield',
                    name: 'code',
                    anchor: '95%',
					fieldLabel: '角色编码'
                },
                {
                    xtype: 'hiddenfield',
                    name: 'id',
                    fieldLabel: 'id'
                },
                {
                    xtype: 'radiogroup',
                    fieldLabel: '禁止使用',
					columns: 2,
            		vertical: true,
                    items: [
                        {
                            xtype: 'radiofield',
							name:'disabled',
                            boxLabel: '否',
							checked:true,
                            inputValue: 0
                        },
                        {
                            xtype: 'radiofield',
                            name:'disabled',
							boxLabel: '是',
                            inputValue: 1
                        }
                    ]
                },
                 {
					xtype:'combobox',
			        fieldLabel: '系统角色定义',
					name:'role',
			        displayField: 'name',
					forceSelection: true,
					valueField:'id',
			        width: 320,
			        labelWidth: 80,
					editable:false,
					store:dsSysRoleIds,
					mode:'local',
			        queryMode: 'local',
			        typeAhead: true
			    },
                {
                    xtype: 'textareafield',
					name:'remark',
                    fieldLabel: '备 注',
                    anchor: '95%'
                },
				
				{
					xtype: 'container',
            		anchor: '95%',
            		layout: 'hbox',
			  	    fieldDefaults: {
		            	labelWidth: 65
		        	},					
					items:[{
		                xtype: 'container',
        	        	flex: 1,
            	    	layout: 'anchor',
               		 	items: [
						{
                    		xtype:'displayfield',
                    		fieldLabel: '创建日期',
                    		name: 'createdDate',
                    		anchor:'95%'
                		}, {
                    		xtype:'displayfield',
                    		fieldLabel: '创建人',
                    		name: 'createdUser',
                    		anchor:'95%'
                		}]
            		},{
		                xtype: 'container',
		                flex: 1,
		                layout: 'anchor',
		                items: [
						{
                    		xtype:'displayfield',
                    		fieldLabel: '更新日期',
                    		name: 'updatedDate',
                    		anchor:'95%'
                		}, {
                    		xtype:'displayfield',
                    		fieldLabel: '更新人',
                    		name: 'updatedUser',
                    		anchor:'95%'
                		}]
            		}
					]
				}								
            ]			
        });

        me.callParent(arguments);
    }

});